package by.semerikov;


import java.util.List;

import by.semerikov.config.YampReader;
import by.semerikov.converter.tostring.StatisticByCodePersentToStringFormater;
import by.semerikov.converter.tostring.StatisticByCodeToStringFormater;
import by.semerikov.converter.tostring.StatisticByHourToStringFormater;
import by.semerikov.converter.tostring.StatisticByPartDayToStringFormater;
import by.semerikov.converter.tostring.StatisticByTypeToStringFormater;
import by.semerikov.generator.AccessLog;
import by.semerikov.generator.properties.Properties;
import by.semerikov.parser.TextParserFromFile;
import by.semerikov.parts.Log;
import by.semerikov.statictic.StaticticByCode;
import by.semerikov.statictic.StaticticByCodePersents;
import by.semerikov.statictic.StaticticByHour;
import by.semerikov.statictic.StaticticByPartDay;
import by.semerikov.statictic.StaticticByType;
import by.semerikov.store.FileSystemStore;

public class Main {

	/*
			 
	 *   */
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		YampReader.getProperties();
		AccessLog genLog = new AccessLog(new Properties());
		FileSystemStore fs = new FileSystemStore();
		fs.save("E:\\testFile.txt", genLog, 100);
		TextParserFromFile tpf = new TextParserFromFile("E:\\testFile.txt");
		List<Log> list = tpf.getLogs();
		System.out.println( "--------Statictic By Hour -------------------------");
		StatisticByHourToStringFormater s = new StatisticByHourToStringFormater();
		System.out.println(s.convert(new StaticticByHour(list).getStaticticByHour()));
		
		System.out.println( "--------Statictic By Part Day ---------------------");
		StatisticByPartDayToStringFormater spd = new StatisticByPartDayToStringFormater();
		System.out.println( spd.convert(new StaticticByPartDay(list).getStaticticByPartDay()));
		
		System.out.println( "--------Statictic By Code -------------------------");
		StatisticByCodeToStringFormater sbc = new StatisticByCodeToStringFormater();
		System.out.println(sbc.convert(new StaticticByCode(list).getSortedByCode()));
		
		System.out.println( "--------Statictic By Code Persent -------------------------");
		StatisticByCodePersentToStringFormater sbcp = new StatisticByCodePersentToStringFormater();
		System.out.println(sbcp.convert(new StaticticByCodePersents(list).getStaticticByCode()));
		
		System.out.println( "--------Statictic By Type -------------------------");
		StatisticByTypeToStringFormater sbt = new StatisticByTypeToStringFormater();
		System.out.println(sbt.convert(new StaticticByType(list).getStaticticByType()));
	}

}
